import { defineStore } from "pinia"
import { ref } from "vue"
const useTokenStore = defineStore(
  "token",
  () => {
    const token = ref<string | null>(null)
    const updateToken = (value: string) => (token.value = value)
    const clearToken = () => (token.value = null)
    return {
      token,
      updateToken,
      clearToken,
    }
  },
  {
    persist: true, // 开启持久化
  }
)
export default useTokenStore
